# CMakeLists.txt for src/

# ############################################################

# Create config.h

SET (GETTEXT_PACKAGE "gnucash")

IF (WIN32)
  SET (HAVE_SCANF_I64D 1)
  SET (HAVE_HTMLHELPW 1)
ENDIF (WIN32)

IF (MINGW)
  SET (HAVE_PUTENV 1)
ENDIF (MINGW)

CHECK_INCLUDE_FILES (X11/Xlib.h HAVE_X11_XLIB_H)
CHECK_INCLUDE_FILES (dirent.h HAVE_DIRENT_H)
CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H)
CHECK_INCLUDE_FILES (glob.h HAVE_GLOB_H)
CHECK_INCLUDE_FILES (inttypes.h HAVE_INTTYPES_H)
CHECK_INCLUDE_FILES (limits.h HAVE_LIMITS_H)
CHECK_INCLUDE_FILES (locale.h HAVE_LOCALE_H)
CHECK_INCLUDE_FILES (memory.h HAVE_MEMORY_H)
CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H)
CHECK_INCLUDE_FILES (stdlib.h HAVE_STDLIB_H)
CHECK_INCLUDE_FILES (string.h HAVE_STRING_H)
CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H)
CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILES (sys/time.h HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILES (sys/times.h HAVE_SYS_TIMES_H)
CHECK_INCLUDE_FILES (sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILES (sys/wait.h HAVE_SYS_WAIT_H)
CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILES (utmp.h HAVE_UTMP_H)
CHECK_INCLUDE_FILES (wctype.h HAVE_WCTYPE_H)

IF (UNIX OR MINGW)
  SET (HAVE_BIND_TEXTDOMAIN_CODESET 1)
  SET (HAVE_DCGETTEXT 1)
  SET (HAVE_GETTEXT 1)
  SET (HAVE_GETTIMEOFDAY 1)
  SET (HAVE_GUILE 1)
  SET (HAVE_LIBM 1)
  SET (HAVE_MEMCPY 1)
  SET (STDC_HEADERS 1)
  SET (_ALL_SOURCE 1)
  SET (_GNU_SOURCE 1)
  SET (_POSIX_PTHREAD_SEMANTICS 1)
  SET (_TANDEM_SOURCE 1)
  SET (__EXTENSIONS__ 1)
  SET (WORDS_BIGENDIAN 1)
ENDIF (UNIX OR MINGW)

IF (UNIX)
  SET (HAVE_CHOWN 1)
  SET (HAVE_DLERROR 1)
  SET (HAVE_GETHOSTID 1)
  SET (HAVE_GETHOSTNAME 1)
  SET (HAVE_GETPPID 1)
  SET (HAVE_GETUID 1)
  SET (HAVE_GMTIME_R 1)
  SET (HAVE_LANGINFO_D_FMT 1)
  SET (HAVE_LC_MESSAGES 1)
  SET (HAVE_LIBPTHREAD 1)
  SET (HAVE_LINK 1)
  SET (HAVE_LOCALTIME_R 1)
  SET (HAVE_PTHREAD_MUTEX_INIT 1)
  SET (HAVE_SCANF_LLD 1)
  SET (HAVE_SETENV 1)
  SET (HAVE_STPCPY 1)
  SET (HAVE_STRPTIME 1)
  SET (HAVE_STRUCT_TM_GMTOFF 1)
  SET (HAVE_TIMEGM 1)
ENDIF (UNIX)

ADD_DEFINITIONS (-DHAVE_CONFIG_H)

SET (CONFIG_H ${CMAKE_CURRENT_BINARY_DIR}/config.h)
CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake.in ${CONFIG_H})

# ############################################################

# The subdirectories
ADD_SUBDIRECTORY (libqof)
ADD_SUBDIRECTORY (core-utils)
ADD_SUBDIRECTORY (gnc-module)
ADD_SUBDIRECTORY (engine)
ADD_SUBDIRECTORY (backend/xml)
ADD_SUBDIRECTORY (calculation)
ADD_SUBDIRECTORY (app-utils)
IF (WITH_SQL)
  ADD_SUBDIRECTORY (backend/dbi)
  ADD_SUBDIRECTORY (backend/sql)
ENDIF (WITH_SQL)

ADD_SUBDIRECTORY (gnc)

